import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "login",
    component: () => import(/* webpackChunkName: "login" */ "@/views/LoginView.vue"),
  },
  {
    path: "/home",
    name: "home",
    component: () => import(/* webpackChunkName: "home" */ "@/views/HomeView.vue"),
    children: [
      {
        path: "",
        name: "welcome",
        component: () => import(/* webpackChunkName: "welcome" */ "@/views/WelcomeView.vue"),
      },
      {
        path: "admin",
        name: "admin",
        component: () => import(/* webpackChunkName: "admin" */ "@/views/AdminView.vue"),
      },
      {
        path: "class",
        name: "class",
        component: () => import(/* webpackChunkName: "class" */ "@/views/ClassView.vue"),
      },
      {
        path: "course",
        name: "course",
        component: () => import(/* webpackChunkName: "course" */ "@/views/CourseView.vue"),
      },
      // 大屏报表页面
      {
        path: 'echarts',
        name: 'echarts',
        component: () => import(/* webpackChunkName: "echarts" */ '@/views/EchartsView.vue')
      },
      {
        path: "classCheck",
        name: "classCheck",
        component: () => import(/* webpackChunkName: "classCheck" */ "@/views/ClassCheckView.vue"),
      },
      {
        path: "updateSelf",
        name: "updateSelf",
        component: () => import(/* webpackChunkName: "updateSelf" */ "@/views/UpdateSelfView.vue"),
      },
      // 使用params传参
      {
        path: "chapter/:courseName/:courseId",
        name: "chapter",
        component: () => import(/* webpackChunkName: "chapter" */ "@/views/ChapterView.vue"),
        props: route => ({params: route.params})
      },
      {
        path: "user",
        name: "user",
        component: () => import(/* webpackChunkName: "user" */ "@/views/UserView.vue"),
      },
      {
        path: "correcting",
        name: "correcting",
        component: () => import(/* webpackChunkName: "correcting" */ "@/views/CorrectingView.vue"),
      }

    ]
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
